home *** CD-ROM | disk | FTP | other *** search
/ MacFormat 2000 July / macformat-092.iso / Dreamweaver 3 / Configuration / Commands / Design Notes_onOpen.js < prev    next >
Encoding:
Text File  |  1999-12-01  |  1.1 KB  |  34 lines

  1. // Copyright 1999 Macromedia, Inc. All rights reserved.
  2.  
  3. //******************* GLOBALS **********************
  4.  
  5. var CMD_TO_LAUNCH = "Design Notes.htm";
  6. var KEY_OPEN   = "showOnOpen";
  7.  
  8. //***************** API  ******************
  9.  
  10. function canAcceptCommand() {
  11.   return true;
  12. }
  13.  
  14. //***************** LOCAL FUNCTIONS  ******************
  15.  
  16. function onOpen() {
  17.   var filePath = "", src, metafile;
  18.  
  19.   filePath = dw.getDocumentPath("document");
  20.   if (filePath) {                         //if file is saved
  21.     metafile = MMNotes.open(filePath);  //open, or create metafile
  22.     if (metafile) {                           //if opened ok
  23.       temp = MMNotes.get(metafile,KEY_OPEN);  //read KEY_OPEN
  24.       MMNotes.close(metafile);                //close file
  25.       if (temp && temp.toString().toLowerCase() == "true") { //if KEY_OPEN flag and set to true
  26.  
  27.         var fObj = new File(filePath);                    //determine if file is writeable
  28.         MMNotes.FileInfo_isWriteable = (fObj.canWrite());
  29.  
  30.         MMNotes.FileInfo_filePath = filePath;    //store the filePath as a global
  31.         dw.popupCommand(CMD_TO_LAUNCH); //launch the command
  32.   } } }
  33. }
  34.